package com.seraphine.framework.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionTemplate;


/**
 * @Auther: panhongtong
 * @Date: 2020/4/1 09:02
 * @Description:
 */
@Configuration
//配置扫描组件的路径，这里配置了多个路径
@ComponentScan(basePackages = {"${" + Constants.APP_BASE_PACKAGE + "},com.seraphine.api.**"})
public class MainConfig {

    @Bean
    @Primary
    public TransactionTemplate transactionTemplate(PlatformTransactionManager transactionManager) {
        TransactionTemplate transactionTemplate = new TransactionTemplate();
        transactionTemplate.setTransactionManager(transactionManager);
        return transactionTemplate;
    }
}
